﻿
// ****************************************************************
// 
// Copyright © 2013
// Author:Neil
// Creation Time:2013/6/7 23:18:45
// 
// File Name:StringExtensions.cs
// File Description:
// 
// ****************************************************************


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Kunlun.Common
{
    /// <summary>
    /// 字符串类的扩展函数
    /// </summary>
    public static class StringExtensions
    {
        /// <summary>
        /// 判断给定的字符串是否为Int32
        /// </summary>
        /// <param name="str">待判断的字符串</param>
        /// <returns>返回true，表示给定的字符串可以转换为Int32；否则返回false</returns>
        public static bool IsInt32(this string str)
        {
            Int32 temp;

            if (String.IsNullOrEmpty(str) || !Int32.TryParse(str, out temp))
            {
                return false;
            }
            return true;
        }
    }
}



